/*
 * Copyright (c) Hisilicon Technologies Co., Ltd. 2019-2019. All rights reserved.
 * Description: video analysis video process interface
 * Author: HiMobileCam Reference Develop Team
 * Create: 2019-11-01
 */

#ifndef HI_VIDEO_PROCESS_H
#define HI_VIDEO_PROCESS_H

#include "hi_appcomm.h"
#include "hi_mapi_vproc_define.h"

#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */

/* invalid argument error code  */
#define HI_VIDEOPROCESS_EINVAL       HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_EINVAL)
/* already initialed error code */
#define HI_VIDEOPROCESS_EINITIALIZED HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_EINITIALIZED)
/* container is full error code */
#define HI_VIDEOPROCESS_EFULL        HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_EFULL)
/* not init error code          */
#define HI_VIDEOPROCESS_ENOTINIT     HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_ENOINIT)
/* task is busy error code      */
#define HI_VIDEOPROCESS_EBUSY        HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_EBUSY)
/* no resource error code       */
#define HI_VIDEOPROCESS_ENORES       HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_ENORES)
/* other fail error code        */
#define HI_VIDEOPROCESS_EOTHER       HI_APPCOMM_ERR_ID(HI_APP_MOD_VIDEOPROCESS, HI_EOTHER)

#define HI_VIDEOPROCESS_TASK_ALG_NUM_MAX  3

typedef enum {
    HI_VIDEOPROCESS_ALG_TYPE_ADAS = 0, /* adas */
    HI_VIDEOPROCESS_ALG_TYPE_BUTT
} HI_VIDEOPROCESS_AlgType;

typedef enum {
    HI_VIDEOPROCESS_YUV_MOD_VCAP = 0,
    HI_VIDEOPROCESS_YUV_MOD_VPSS,
    HI_VIDEOPROCESS_YUV_MOD_BUTT
} HI_VIDEOPROCESS_YuvMode;

typedef struct {
    HI_VIDEOPROCESS_YuvMode yuvMode;
    HI_HANDLE modHdl;
    HI_HANDLE chnHdl;
    HI_U32 dumpDepth;
} HI_VIDEOPROCESS_YuvSrc;

typedef HI_S32 (*HI_VIDEOPROCESS_TaskCb)(HI_MAPI_FRAME_DATA_S *algData, HI_VOID* privData);

typedef struct {
    HI_VIDEOPROCESS_TaskCb taskCb;
    HI_VOID* privData;
} HI_VIDEOPROCESS_TaskCallbackSet;

typedef struct {
    HI_VIDEOPROCESS_AlgType algType;
    HI_VIDEOPROCESS_TaskCallbackSet taskCbSet;
} HI_VIDEOPROCESS_AlgAttr;

typedef struct {
    HI_U32 algCnt;
    HI_S32 frameRate;
    HI_U32 bufDepth;
    HI_VIDEOPROCESS_YuvSrc  yuvSrc;
    HI_VIDEOPROCESS_AlgAttr algAttr[HI_VIDEOPROCESS_TASK_ALG_NUM_MAX];
} HI_VIDEOPROCESS_TaskCfg;

HI_S32 HI_VIDEOPROCESS_Init(HI_VOID);

HI_S32 HI_VIDEOPROCESS_CreateTask(const HI_VIDEOPROCESS_TaskCfg *taskCfg, HI_HANDLE *taskHdl);

HI_S32 HI_VIDEOPROCESS_StartTask(HI_HANDLE taskHdl);

HI_S32 HI_VIDEOPROCESS_StopTask(HI_HANDLE taskHdl);

HI_S32 HI_VIDEOPROCESS_DestroyTask(HI_HANDLE taskHdl);

HI_S32 HI_VIDEOPROCESS_Deinit(HI_VOID);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */

#endif /* HI_VIDEO_PROCESS_H */
